<?php
    $dateNow = date('Y');
?>
<script type="text/javascript">
    $(document).ready(function(){
        getDatePicker('birthday');
    });
    var baseUrl = '<?php echo $this->baseUrl(); ?>';
    // datepicker
    function getDatePicker(_id) {
    $("#"+_id).datepicker({
         showOn:'button',
         dateFormat:"dd-mm-yy",
         buttonImage:baseUrl+'/public/templates/admin/js/calendar/images/calendar.gif',
         buttonImageOnly:true,
         yearRange: '1920:<?php echo $dateNow; ?>',
         changeMonth:true,
         changeYear:true,
         showMonthAfterYear: true
       });
     }
</script>
    <div class="list_category">
        <ul>
            <li><a href="<?php echo $this->baseUrl('admincp/user'); ?>">Quản lý tài khoản</a></li>
            <li><a href="<?php echo $this->baseUrl('admincp/user/create'); ?>">Tạo tài khoản mới</a></li>
        </ul>
    </div>
</div>

<!-- Begin Content -->
<div class="section">
    <div class="heading_section">
        <span>Tạo tài khoản mới</span>
    </div>
    
    <div class="content">
    <form action="" method="post" enctype="multipart/form-data">
        <table class="table">
            <tr>
                <td class="td1"><?php echo $this->formLabel('email','Địa chỉ email'); ?>&nbsp;<span class="error-msg">*</span></td>
                <td class="td2"><?php echo $this->formText('email',$this->data['email'],array('class'=>'input')); ?></td>
                <td class="td3"><?php echo $this->errorEmail; ?></td>
            </tr>
            <tr>
                <td class="td1"><?php echo $this->formLabel('password','Mật khẩu'); ?>&nbsp;&nbsp;&nbsp;</td>
                <td class="td2"><?php echo $this->formPassword('password',null,array('class'=>'input')); ?></td>
                <td class="td3"><?php echo $this->errorPassword; ?></td>
            </tr>
            <tr>
                <td class="td1"><?php echo $this->formLabel('rePassword','Nhập lại mật khẩu'); ?>&nbsp;&nbsp;&nbsp;</td>
                <td class="td2"><?php echo $this->formPassword('rePassword',null,array('class'=>'input')); ?></td>
                <td class="td3"><?php echo $this->errorRePassword; ?></td>
            </tr>
            <tr>
                <td class="td1"><?php echo $this->formLabel('fullname','Tên đầy đủ'); ?>&nbsp;<span class="error-msg">*</span></td>
                <td class="td2"><?php echo $this->formText('fullname',$this->data['fullname'],array('class'=>'input')); ?></td>
                <td class="td3"><?php echo $this->errorFullname; ?></td>
            </tr>
            <tr>
                <td class="td1"><?php echo $this->formLabel('gender', 'Giới tính'); ?>&nbsp;&nbsp;&nbsp;</td>
                <td class="td2">
                    <?php
                        echo $this->formSelect('gender',$this->data['gender'],
                        array('class'=>'selectbox'),
                        array(
                            '1'=>'Nam',
                            '2'=>'Nữ',
                        )); 
                    ?>
                </td>
                <td class="td3">&nbsp;</td>
            </tr>
            <?php $common = new Admincp_Model_Common(); ?>
            <tr>
                <td class="td1"><?php echo $this->formLabel('birthday','Ngày sinh'); ?>&nbsp;<span class="error-msg">*</span></td>
                <td class="td2"><?php echo $this->formText('birthday',$common->formatDate($this->data['birthday']),array('class'=>'input','style'=>'width: 180px')); ?></td>
                <td class="td3"><?php echo $this->errorBirthday; ?></td>
            </tr>
            <tr>
                <td class="td1"><?php echo $this->formLabel('role', 'Quyền hạn'); ?>&nbsp;&nbsp;&nbsp;</td>
                <td class="td2">
                    <?php
                        echo $this->formSelect('role',$this->data['role'],
                        array('class'=>'selectbox'),
                        array(
                            '1'=>'Quản trị',
                            '2'=>'Thành viên',
                        ));
                    ?>
                </td>
                <td class="td3">&nbsp;</td>
            </tr>
            <tr>
                <td class="td1"><?php echo $this->formLabel('oldAvatar', 'Ảnh đại diện'); ?>&nbsp;&nbsp;&nbsp;</td>
                <td class="td2">
                <?php
                    if($this->data['avatar'] == '0') {
                        $avatar = 'no-avatar.gif';
                    }
                    else {
                        $avatar = $this->data['avatar'];
                    }
                ?>
                    <img width="60px" height="60px" src="<?php echo $this->baseUrl('/public/files/user/').$avatar; ?>" />
                </td>
                <td class="td3">&nbsp;</td>
            </tr>
            <tr>
                <td class="td1"><?php echo $this->formLabel('avatar', 'Ảnh mới(nếu có)'); ?>&nbsp;&nbsp;&nbsp;</td>
                <td class="td2"><?php echo $this->formFile('avatar', array('class'=>'selectbox')); ?></td>
                <td class="td3"><?php echo $this->errorAvatar; ?></td>
            </tr>
            <tr>
                <td class="td1"><?php echo $this->formLabel('status', 'Trạng thái'); ?>&nbsp;&nbsp;&nbsp;</td>
                <td class="td2">
                    <?php
                        echo $this->formSelect('status',$this->data['status'],
                        array('class'=>'selectbox'),
                        array(
                            '1'=>'Hoạt động',
                            '0'=>'Khóa',
                        ));
                    ?>
                </td>
                <td class="td3">&nbsp;</td>
            </tr>
            <tr>
                <td class="td1">&nbsp;</td>
                <td class="td2">
                    <?php echo $this->formSubmit('submit','Cập nhật',array('class'=>'button')); ?>
                    <?php echo $this->formReset('reset','Nhập lại',array('class'=>'button')); ?>
                </td>
                <td class="td3"></td>
            </tr>
        </table>
    </form>
    </div>
</div>
<!-- End Content -->